All Questions
Tagged with design-patternspython
126 questions
4votes
3answers
329views
numpy array/item handling functions
Recently I have been using numpy arrays, which have great utility via their broadcasting methods. I am attempting to write a useful public facing library, and this ...
1vote
1answer
110views
Database design using Closure Table for tagging system
I created these database tables with the inspiration in NjDevPro github repository. The design uses Closure Table for implementation of hierarchical tagging system in ...
4votes
2answers
111views
Managing file paths in a python Data Science project
When doing Data Science projects, I often have to load data and metadata, and output results, plots, logs, etc. Therefore I have to handle all the file paths from where to load the input and write the ...
5votes
2answers
124views
Argument Order To Determine Order Of Output (Python; `attrs`)
Feedback Request Is the manner in which I use attrs adequate (i.e. designed well)? Should I not expect to be able to use argument ordering to order the joining of ...
1vote
1answer
284views
Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?
This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
2votes
1answer
98views
Semi-generic data loading utility class
The following implements a relatively generic and modular data loading utility. It loads images from a local storage given a lookup table. The data loader is parametrized via dependency injection to ...
5votes
2answers
415views
Poker bets on Python
I'm writing poker for my bot in discord. So far I'm presenting an incomplete version of the project, which is only a betting system. The development took a lot of time, so I decided to ask for help. ...
2votes
1answer
187views
CPU emulator written in python (Adjustable Microcode!)
I've designed and implemented a CPU architecture in one day. Of key architectural details: Processor is supposed to support updatable microcode, Architecture extensions and Is designed to be ...
4votes
3answers
1kviews
Python Enum Strategy Pattern
I have two behaviours: pulling or cloning a git repository. It started as an Enum, but then I had to switch over the enum all the time. I wanted to turn it into some kind of strategy pattern and ...
2votes
1answer
601views
Model-View-Presenter (MVP) pattern implementation
To learn more about design patterns, particularly the Model-View-Presenter (MVP) pattern, I am currently creating a CLI weight tracker application in Python. I would like you to review the code to ...
2votes
1answer
78views
Class handling file conversion and data manipulation archiving [h5py]
I am a physics PhD student who co-developped a python package for file conversion of standard file format used in Scanning Probe Microscopy (SPM) and archiving of data manipulation for tracability. If ...
1vote
0answers
1kviews
MVVM using Python's tkinter
My task is to change the architecture of a previously written application to Model-View-ViewModel and use the Command pattern. It is written in Python 3.10.6 and uses the tkinter library for the GUI. ...
2votes
2answers
127views
Python Logger Implementation
I have developed an implementation of a logger in Python. I know that Python already has a built-in logger, my goal with this is to get feedback and suggestions for improvement, particularly about ...
1vote
2answers
152views
Replace personal names and addresses with company ones
The problem: I am given a data frame. Somewhere in that dataframe there is 3*N number of columns that I need to modify based on a condition. The columns of interest look like this: names_1 address_1 ...
-1votes
1answer
64views
Replacing private helper methods with global functions in Python? [closed]
In Python there is no real notion of private access. It's merely suggested by social convention with _ prepended in method names. ...